Relational and object-relational database management systems store information in tables in a database. To retrieve data, query statements requesting data are submitted to a database server. The database server processes the queries and returns the requested data. Processing a query involves parsing the query, generating a set of query plans, selecting the optimal query plan, and sending the optimal execution plan for execution. A query plan can also be considered as an ordered grouping of expression trees. Typical examples of expression trees are a column in a projection list of an operator, or a grouping column, order by column or a predicate.
During execution of the query plan, the runtime system may need to deal with multiple possible encodings for the given data types in its expression tree.
Assuming that a database system supports different encoding types for a same data-type, some problems arise. One problem is that dealing with different encodings at runtime presents significant complications in the runtime operator code. Another problem is that, in database systems that employ vectorization, efficient vectorization becomes difficult, particularly as expressions increase in complexity. A third problem is a difficulty in avoiding decoding/re-encoding of values through the application of constants.
The approaches described in this section are approaches that could be pursued, but not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.